import request from "@/utils/request"

/**
 * 获取权限列表
 * @returns {AxiosPromise}
 */
export const getPermissionList = () => {
  return request({
    url: '/sys/permission',
    method: 'GET'
  })
}

/**
 * 新增权限
 * @param data
 * @returns {AxiosPromise}
 */
export const addPermission = (data) => {
  return request({
    url: '/sys/permission',
    method: 'POST',
    data
  })
}

/**
 * 更新权限
 * @param data
 * @returns {AxiosPromise}
 */
export const updatePermission = (data) => {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'PUT',
    data
  })
}

/**
 * 删除权限
 * @param id
 * @returns {AxiosPromise}
 */
export const delPermission = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'DELETE'
  })
}

/**
 * 根据id获取权限详情
 * @param id
 * @returns {AxiosPromise}
 */
export const getPermissionDetail = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'GET'
  })
}
